package com.lepu.app.fun.health.adapter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.BaseAdapter;

import com.lepu.pasm.R;

public class DurgDetailAdapter extends BaseAdapter {

	public LayoutInflater mLayoutInflater = null;
	public Context mContext = null;
	public String mLoadData;

	public DurgDetailAdapter(Context context,String loadData) {
		mContext = context;
		mLayoutInflater = LayoutInflater.from(context);
		mLoadData = loadData;
	}

	@Override
	public int getCount() {
		return 1;
	}

	@Override
	public Object getItem(int position) {
		return position;
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@SuppressLint("InflateParams")
	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {

		final ViewHolder holder;

		if (convertView == null) {
			convertView = mLayoutInflater.inflate(R.layout.health_durg_detail_listitem, null);

			holder = new ViewHolder();

			WebView webView = (WebView) convertView.findViewById(R.id.webView);
			holder.webView = webView;

			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}

		holder.webView.loadData(mLoadData,"text/html", "UTF-8");

		return convertView;
	}

	private static class ViewHolder {
		WebView webView;
	}
}
